/*
 * MainWindow.h
 *
 *  Created on: May 13, 2012
 *      Author: walther
 */

#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_

#include <gtk/gtk.h>

#include "MainWindowPresenter.h"

class MainWindow
{
public:
    /**
     * Constructor
     */
    MainWindow();
    
    /**
     * Destructor
     */
    virtual ~MainWindow();
    
    /**
     * Displays the window
     */
    void show();

private:
    
    /** Interface building */
    GtkWidget* build();
    GtkWidget* buildButtonsBox();
    GtkWidget* buildCanvasBox();
    GtkWidget* buildRayTraceCanvas();
    GtkWidget* buildToggleBox();
    GtkWidget* buildSpaceSubdivisionBox();

    /** Callbacks */
    static gboolean cb_configGLCanvas( GtkWidget* canvas, GdkEventConfigure* event, gpointer user_data );
    static gboolean cb_exposeGLCanvas( GtkWidget* canvas, GdkEventExpose* event, gpointer user_data );
    static void cb_openScene( GtkWidget* button, gpointer user_data );
    static void cb_render( GtkWidget* button, gpointer user_data );
    static gboolean cb_deleteWindow( GtkWidget* widget, GdkEvent* event, gpointer data );
    static void cb_toggleButton( GtkToggleButton* togglebutton, gpointer user_data );
    static void cb_toggleRegularGrid( GtkToggleButton* togglebutton, gpointer data );
    static void cb_rebuildGrid( GtkWidget* button, gpointer user_data );
    static void cb_rayMemoryValueChanged( GtkSpinButton* spinbutton, gpointer data );
    static gboolean cb_keyPress( GtkWidget *widget, GdkEventKey *event, gpointer user_data );

    /** Interface elements */
    GtkWidget* _window;
    GtkWidget* _rayTraceCanvas;
    GtkWidget* _messageBar;
    GtkWidget* _fileLabel;
    
    GtkWidget* _ambientToggle;
    GtkWidget* _diffuseToggle;
    GtkWidget* _specularToggle;
    GtkWidget* _shadowToggle;
    GtkWidget* _softShadowToggle;
    GtkWidget* _reflectionToggle;
    GtkWidget* _antiAliasToggle;
        
    GtkWidget* _regularGridToggle;
    GtkWidget* _nxSpin;
    GtkWidget* _nySpin;
    GtkWidget* _nzSpin; 
    GtkWidget* _memorySpin; 
    GtkWidget* _nxLabel;
    GtkWidget* _nyLabel;
    GtkWidget* _nzLabel;
    GtkWidget* _memoryLabel;
    GtkWidget* _rebuildButton;
            
    /** Presenter */
    MainWindowPresenter* _presenter;
};

#endif /* MAINWINDOW_H_ */
